

#[derive(serde::Deserialize, serde::Serialize, Clone, Copy, Default, Debug)]
pub struct Complex {
    pub real: f64,
    pub imag: f64,
}

impl Complex {
    pub fn new(real: f64, imag: f64,) -> Self {
        Self { real, imag }
    }
}

impl Complex {
    pub fn to_print(&self) -> String {
        format!("({}, {})", self.real, self.imag)
    }
}

impl Complex {
    pub fn near_zero(&self) -> bool {
        self.real.abs() < EPPSILON
            && self.imag.abs() < EPPSILON
    }

    pub fn equals_0_0(&self) -> bool {
        self.real == 0.0 && self.imag == 0.0
    }

    pub fn equals_1_0(&self) -> bool {
        self.real == 1.0 && self.imag == 0.0
    }
    // pub fn real(&self) -> f64 {
    //     self.real
    // }
    // pub fn imag(&self) -> f64 {
    //     self.imag
    // }
}
/// [Machine epsilon] value for `f64`.: pub const EPSILON: f64 = 2.2204460492503131e-16_f64;
const EPPSILON: f64 = 1e-8_f64;

impl Complex {
}